/*
 * @Descripttion:
 * @Author: voanit
 * @Date: 2022-03-22 15:36:59
 * @LastEditors: voanit
 * @LastEditTime: 2022-03-22 15:52:12
 */
import React from 'react'
import { useSelector, useDispatch } from 'react-redux'
const Thunk = () => {
  const dispatch = useDispatch()
  const arrName = useSelector((state) => state.thunk)

  const action1 = (dispatch) => {
    dispatch({ type: 'thunk/add', payload: 'tom' })
  }
  return (
    <div>
      御剑乘风来,除魔天地间!==Thunk==={arrName}===
      {/* <button style={{ background: 'pink' }}>Thunk</button> */}
      <input
        type="button"
        value="Thunk"
        onClick={() => {
          dispatch({ type: 'thunk/add', payload: 'tom' })
        }}
      />
      ====
      <input
        type="button"
        value="Thunk22222"
        onClick={async () => {
          //  await 发生请求
          dispatch(action1)
        }}
      />
    </div>
  )
}
export default Thunk
